package demo.maven.bean.service.impl;

import demo.maven.bean.dao.impl.UserDao;
import demo.maven.bean.domain.User;
import demo.maven.bean.factory.BeanFactory;
import demo.maven.bean.service.UserService;

import java.util.List;

/**
 * @author peter
 * @date 2021/12/4 下午10:32
 */
public class UserServiceImpl implements UserService {

    UserDao userDao = (UserDao) BeanFactory.getBean("userDao");

    Integer num = 0;

    public List<User> selectAll() {

        return userDao.selectAll();
    }

    public Integer addUserDao(Integer addNum) {
        return userDao.getIbyAdd(addNum);
    }

    @Override
    public Integer getIbyAdd(Integer addNum) {
        return num+=addNum;
    }

    public Integer getIbyAdd2(Integer addNum) {
        num=0;
        return num+=addNum;
    }
}
